Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babel/plugin-proposal-private-methods

Package Overview
Dependencies
Maintainers
4
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-proposal-private-methods

This plugin transforms private class methods

  • 7.18.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8M
decreased by-7.62%
Maintainers
4
Weekly downloads
 
Created

What is @babel/plugin-proposal-private-methods?

The @babel/plugin-proposal-private-methods package is a Babel plugin that allows developers to use the private methods and accessors proposal in JavaScript classes. This proposal is part of the ECMAScript (ES) standardization process and introduces a way to define private methods and getter/setter functions in a class, which are only accessible within the class itself.

What are @babel/plugin-proposal-private-methods's main functionalities?

Private Methods

This feature allows the definition of methods in a class that are not accessible from outside the class. The hash (#) prefix indicates that the method is private.

class MyClass {
  #privateMethod() {
    return 'Hello from private method';
  }

  publicMethod() {
    return this.#privateMethod();
  }
}

Private Accessors

This feature allows the definition of private getter and setter functions in a class, which can be used to control access to private fields.

class MyClass {
  #privateField = 'private value';

  get #privateAccessor() {
    return this.#privateField;
  }

  set #privateAccessor(newValue) {
    this.#privateField = newValue;
  }

  publicMethod() {
    return this.#privateAccessor;
  }
}

Other packages similar to @babel/plugin-proposal-private-methods

Keywords

FAQs

Package last updated on 27 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc